package com.huaxia.service.A_PV;

import com.huaxia.dao.A_PV.PVMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author wangli 爱我华夏，爱我中华！
 * @date 2020/10/22 10:00
 */
@Service
public class PVService {

    @Autowired
    private PVMapper pvMapper;


    public void addPv() {
        String nowDate = new SimpleDateFormat("yyyyMMdd").format(new Date());
        Integer nowDateNum = pvMapper.findByNowDate(nowDate);
        if(nowDateNum==null||nowDateNum==0){
            pvMapper.insertNowDate(nowDate);
        }else{
            pvMapper.addPv(nowDate);
        }

    }

    public Integer findPv() {
        return pvMapper.findPv();
    }
}
